import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import ElementPlus from 'unplugin-element-plus/vite'
export default defineConfig({
    plugins: [vue(),ElementPlus()],
    resolve: {  
        alias: {
            '@': resolve(__dirname, './src')         
        }    
    },
    base:"./",
    build:{
        outDir: resolve(__dirname,'../templates'),
        assetsDir:'static',
        // 设置打包大小
        chunkSizeWarningLimit: 1500,
        emptyOutDir:true,
        rollupOptions: {
        output: {
            // 块超过打包大小
            manualChunks(id) {
                if (id.includes('node_modules')) {
                    return id.toString().split('node_modules/')[1].split('/')[0].toString();
                }
            }
        }
        }
    },
    server:{
        port:3000,
        host: '0.0.0.0',
        proxy:{
            "/admin":{
                target:"http://127.0.0.1:11111"
            },
            "/front":{
                target:"http://127.0.0.1:11111"
            }
        }
    }
})
